@(modelForView: model.forview.NodeRelationAddModelForView)
@main(modelForView.mainModelForView) {

<!-- CONTENT -->
<!-- НАВИГАЦИЯ -->
<div class="span12">
	<div class="well">
		<form method="GET">
			<span>Выбор иерархии для поиска: </span>
			<div class="input-append">
	    		<select  name="idStructure">
					@for( i <- 0 until modelForView.getSizeOfAllStructures()){
						<option value="@modelForView.getIdOfStructure(i)">@modelForView.getTitleOfStructure(i)</option>
					}
		   		</select>
	    		<button class="btn" type="submit"><i class="icon-ok"></i></button>
	    		<a class="btn btn-info" href="@modelForView.getRelationPage()">Вернуться к узлу</a>
				<a class="btn btn-info" href="@modelForView.getRootUrl()">Вернуться в корень</a>
	    	</div>
			<input type="hidden" name="@modelForView.ID_NODE" value="@modelForView.getNodeId()"/>
			
		</form>
		
	</div>
</div>

<!-- РОДИТЕЛИ -->
<div class="span12">
	<div class="well">
		<h4>Родители</h4>
	</div>
	<table class="table table-striped table-bordered table-condensed">
			<thead>
				<tr>
					<th>#</th>
					<th>Название узла</th>
					<th>Иерархия</th>
					<th>Тип</th>
					<th>Создатель</th>
				</tr>
			</thead>
		<tbody>
		@for(i <- 0 until modelForView.getParentsOfRelativeSize()){
			
			<tr>
				<td>@modelForView.getIndex(i)</td>
				<td>
					<a href="@modelForView.getParentOfRelativeUrl(i)">@modelForView.getParentOfRelativeTitle(i)</a> 
				</td>
				<td>
					<a href="@routes.Hierarchy.node(0, modelForView.getParentsOfRelative().get(i).getStructure().getId())" target="_blank">
						@modelForView.getParentsOfRelative().get(i).getStructure().getTitle()
					</a>
				</td>
				<td>
					<a href="@routes.Types.getType(modelForView.getParentsOfRelative().get(i).getType().getID())" target="_blank">
						@modelForView.getParentsOfRelative().get(i).getType().getTitle()
					</a>
				</td>
				<td>@modelForView.getParentsOfRelative().get(i).getCreator().getFullName()</td>
			</tr>
		}
		</tbody>
	</table>
</div>
	
<div class="span5">
	<div class="well">
		<h4>Куда добавляем</h4>
		<b>Имя узла: </b>
		<a href="@routes.Hierarchy.node(modelForView.getNodeId(), 0)" target="_blank">
			@modelForView.getNodeTitle()
		</a><br/>
		<b>Имя иерерхии: </b>
		<a href="@routes.Hierarchy.node(0, modelForView.getStructureId())" target="_blank">
			@modelForView.getStructureTitle()
		</a><br/>
	</div>
</div>
<div class="span2">
	<div class="well pagination-centered">
		<br/>
		<i class="icon-arrow-left"></i>
		<br/><br/>
	</div>
</div>
<div class="span5">
	<div class="well">
		<h4>Что добавляем</h4>
		<b>Имя узла: </b>
		<a href="@routes.Hierarchy.node(modelForView.getRelativeId(), 0)" target="_blank">
			@modelForView.getRelativeTitle()
		</a><br/>
		<b>Имя иерерхии: </b>
		<a href="@routes.Hierarchy.node(0, modelForView.getRelativeStructureId())" target="_blank">
			@modelForView.getRelativeStructureTitle()
		</a><br/>
	</div>
</div>
<div class="span12"><br/></div>
<!-- ДОБАВЛЕНИЕ -->
<div class="span5">
	<form class="pagination-centered" method="POST">
		<input type="hidden" name="@modelForView.ID_NODE" value="@modelForView.getNodeId()"/>
		<input type="hidden" name="@modelForView.ID_RELATIVE" value="@modelForView.getRelativeId()"/>
		<input type="hidden" name="@modelForView.TYPE" value="@modelForView.TYPE_P"/>
		<button id="id_button_submit" type="submit" class="btn btn-primary">Добавить как родителя</button>
	</form>
</div>
<div class="offset2 span5">
	<form class="pagination-centered" method="POST">
		<input type="hidden" name="@modelForView.ID_NODE" value="@modelForView.getNodeId()"/>
		<input type="hidden" name="@modelForView.ID_RELATIVE" value="@modelForView.getRelativeId()"/>
		<input type="hidden" name="@modelForView.TYPE" value="@modelForView.TYPE_C"/>
		<button id="id_button_submit" type="submit" class="btn btn-primary">Добавить как потомка</button>
	</form>
</div>
	
	
<!-- РОДИТЕЛИ -->
<div class="span12">
	<div class="well">
		<h4>Потомки</h4>
	</div>
	<table class="table table-striped table-bordered table-condensed">
			<thead>
				<tr>
					<th>#</th>
					<th>Название узла</th>
					<th>Иерархия</th>
					<th>Тип</th>
					<th>Создатель</th>
				</tr>
			</thead>
		<tbody>
		@for(i <- 0 until modelForView.getChildrenOfRelativeSize()){
			<tr>
				<td>@modelForView.getIndex(i)</td>
				<td>
					<a href="@modelForView.getChildOfRelativeUrl(i)">@modelForView.getChildOfRelativeTitle(i)</a> 
				</td>
				<td>
					<a href="@routes.Hierarchy.node(0, modelForView.getChildrenOfRelative().get(i).getStructure().getId())" target="_blank">
						@modelForView.getChildrenOfRelative().get(i).getStructure().getTitle()
					</a>
				</td>
				<td>
					<a href="@routes.Types.getType(modelForView.getChildrenOfRelative().get(i).getType().getID())" target="_blank">
						@modelForView.getChildrenOfRelative().get(i).getType().getTitle()
					</a>
				</td>
				<td>@modelForView.getChildrenOfRelative().get(i).getCreator().getFullName()</td>
			</tr>
		}
		</tbody>
	</table>
</div>
}
